package com.dt76.smallloanbackendservice.controller.lhuaw;

import com.dt76.smallloanbackendservice.pojo.lhuaw.AppPushMessage;
import com.dt76.smallloanbackendservice.service.lhuaw.AppPushMessageService;
import com.dt76.smallloanbackendservice.utils.Page;
import com.dt76.smallloanbackendservice.utils.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/lhuaw")
public class AppPushMessageController {
    @Resource
    private AppPushMessageService appPushMessageService;
    @RequestMapping("/qryAllApp")
    @ResponseBody
    public List<AppPushMessage> AppPushMessage1(){
        return appPushMessageService.qryAllApp();
    }
    @RequestMapping("/qryConditionPageAllApp")
    @ResponseBody
    public Page qryConditionPageAll(@RequestParam("pageIndex")  int pageIndex,
                                    @RequestParam("pushTitle") String pushTitle,
                                    @RequestParam("appPublisher") String appPublisher){
        System.out.println("成功调用远程");
        return appPushMessageService.getAllAppPushMessage(pageIndex, pushTitle, appPublisher);
    }
    //删除
    @RequestMapping("/delApp")
    @ResponseBody
    public Result delApp(@RequestParam("appId")int appId){
        System.out.println("AppPushMessageController.delApp>>>>>>>>>");
        try {
            appPushMessageService.delApp(appId);
            return new Result(true,"删除成功>>>>>");
        } catch (Exception e) {
            return new Result(false,"删除失败>>>>");
        }
    }
}
